import os
import os
os.environ["PREFECT_API_URL"] = "http://127.0.0.1:4200/api"

from application.extracts.article_ch_extract.process import ArticleChExtract
from application.extracts.info_to_nsfc_extract.process import InfoToNsfcExtract
from application.extracts.kafka_to_info_extract.process import KafkaToInfoExtract

from application.extracts.test_extract.process import testExtract
from application.settings import TOPIC_CONFIG
from application.core.app_manager import FaustAppManager
from application.utils import get_logger

# 创建日志记录器
logger = get_logger(__name__)

# # ----------------- 应用启动 -----------------
# # 初始化应用管理器
# # 检查是否需要从头开始消费
# app_manager = FaustAppManager()

# app_manager.register_agent(TOPIC_CONFIG['default']['topic'], KafkaToInfoExtract())  # 注册流式任务
# app_manager.register_agent(TOPIC_CONFIG['default']['topic'], ArticleChExtract())  # 注册流式任务
# # app_manager.register_timer(interval_seconds=60*2, timer_func=InfoToNsfcExtract())  # 注册定时任务
# root_router = app_manager.get_app()


if __name__ == '__main__':
    # # 注意得现有生产者才能消费
    # logger.info("正在启动Faust应用")
    # root_router.main()
    task = testExtract()
    task.serve()
# uv pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple